home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / wdiff004.lha / wdiff-0.04 / configure < prev    next >
Text File  |  1992-12-23  |  12KB  |  519 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg
  27. do
  28.   # Handle --exec_prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  52.         no_create=1 ;;
  53.  
  54.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  55.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  56.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  57.     next_prefix=yes ;;
  58.  
  59.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  60.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  61.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  62.     next_srcdir=yes ;;
  63.  
  64.      -with-* | --with-*) ;;
  65.  
  66.      *) ;;
  67.     esac
  68.   fi
  69. done
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=wdiff.c
  77.  
  78. # Find the source files, if location was not specified.
  79. if test -z "$srcdir"; then
  80.   srcdirdefaulted=yes
  81.   # Try the directory containing this script, then `..'.
  82.   prog=$0
  83.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  84.   test "X$confdir" = "X$prog" && confdir=.
  85.   srcdir=$confdir
  86.   if test ! -r $srcdir/$unique_file; then
  87.     srcdir=..
  88.   fi
  89. fi
  90. if test ! -r $srcdir/$unique_file; then
  91.   if test x$srcdirdefaulted = xyes; then
  92.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  93.   else
  94.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  95.   fi
  96.   exit 1
  97. fi
  98. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  99. # But we can't avoid them for `..', to make subdirectories work.
  100. case $srcdir in
  101.   .|/*|~*) ;;
  102.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  103. esac
  104.  
  105. if test -z "$CC"; then
  106.   echo checking for gcc
  107.   saveifs="$IFS"; IFS="${IFS}:"
  108.   for dir in $PATH; do
  109.     test -z "$dir" && dir=.
  110.     if test -f $dir/gcc; then
  111.       CC="gcc"
  112.       break
  113.     fi
  114.   done
  115.   IFS="$saveifs"
  116. fi
  117. test -z "$CC" && CC="cc"
  118.  
  119. # Find out if we are using GNU C, under whatever name.
  120. cat <<EOF > conftest.c
  121. #ifdef __GNUC__
  122.   yes
  123. #endif
  124. EOF
  125. ${CC-cc} -E conftest.c > conftest.out 2>&1
  126. if egrep yes conftest.out >/dev/null 2>&1; then
  127.   GCC=1 # For later tests.
  128.   CC="$CC -O"
  129. fi
  130. rm -f conftest*
  131.  
  132. # Make sure to not get the incompatible SysV /etc/install and
  133. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  134. # or the SunOS /usr/etc/install directory, or the AIX /bin/install.
  135. if test -z "$INSTALL"; then
  136.   echo checking for install
  137.   saveifs="$IFS"; IFS="${IFS}:"
  138.   for dir in $PATH; do
  139.     test -z "$dir" && dir=.
  140.     case $dir in
  141.     /etc|/usr/sbin|/usr/etc) ;;
  142.     *)
  143.       if test -f $dir/install; then
  144.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  145.       : AIX
  146.     else
  147.       INSTALL="$dir/install -c"
  148.       INSTALL_PROGRAM='$(INSTALL)'
  149.       INSTALL_DATA='$(INSTALL) -m 644'
  150.       break
  151.     fi
  152.       fi
  153.       ;;
  154.     esac
  155.   done
  156.   IFS="$saveifs"
  157. fi
  158. INSTALL=${INSTALL-cp}
  159. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  160. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  161.  
  162. for p in gnudiff diffgnu gdiff
  163. do
  164. if test -z "$DIFF"; then
  165.   echo checking for $p
  166.   saveifs="$IFS"; IFS="${IFS}:"
  167.   for dir in $PATH; do
  168.     test -z "$dir" && dir=.
  169.     if test -f $dir/$p; then
  170.       DIFF="$p"
  171.       break
  172.     fi
  173.   done
  174.   IFS="$saveifs"
  175. fi
  176. test -z "$DIFF" && DIFF=""
  177.  
  178. test -n "$DIFF" && break
  179. done
  180.  
  181. if test "$DIFF" = gdiff; then
  182.   # Carefully avoid gdiff for X as found on SGI systems.
  183.   DISPLAY= gdiff /dev/null /dev/null > /dev/null 2>&1 || DIFF=
  184. fi
  185. test -n "$DIFF" || DIFF=diff
  186. for p in less more
  187. do
  188. if test -z "$PAGER"; then
  189.   echo checking for $p
  190.   saveifs="$IFS"; IFS="${IFS}:"
  191.   for dir in $PATH; do
  192.     test -z "$dir" && dir=.
  193.     if test -f $dir/$p; then
  194.       PAGER="$p"
  195.       break
  196.     fi
  197.   done
  198.   IFS="$saveifs"
  199. fi
  200. test -z "$PAGER" && PAGER=""
  201.  
  202. test -n "$PAGER" && break
  203. done
  204.  
  205.  
  206. echo checking for Xenix
  207. echo checking how to run the C preprocessor
  208. if test -z "$CPP"; then
  209.   CPP='${CC-cc} -E'
  210.   cat <<EOF > conftest.c
  211.  
  212. #include <stdio.h>
  213. EOF
  214. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  215. if test -z "$err"; then
  216.   :
  217. else
  218.   CPP=/lib/cpp
  219. fi
  220. rm -f conftest*
  221. fi
  222.  
  223. cat <<EOF > conftest.c
  224.  
  225. #if defined(M_XENIX) && !defined(M_UNIX)
  226.   yes
  227. #endif
  228.  
  229. EOF
  230. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  231. if egrep "yes" conftest.out >/dev/null 2>&1; then
  232.   XENIX=1
  233. fi
  234. rm -f conftest*
  235.  
  236. if test -n "$XENIX"; then
  237.   LIBS="$LIBS -ltermlib"
  238. else
  239.   LIBS="$LIBS -ltermcap"
  240. fi
  241.  
  242. echo checking for malloc library
  243. # Irix requires -lmalloc for some unknown reason.
  244. if test -r /usr/lib/libmalloc.a; then
  245.   LIBS="$LIBS -lmalloc"
  246. fi
  247.  
  248. echo checking for POSIXized ISC
  249. if test -d /etc/conf/kconfig.d &&
  250.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  251. then
  252.   ISC=1 # If later tests want to check for ISC.
  253.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  254.   if test -n "$GCC"; then
  255.     CC="$CC -posix"
  256.   else
  257.     CC="$CC -Xp"
  258.   fi
  259. fi
  260.  
  261. echo checking for working const
  262. echo "
  263. main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
  264. typedef int charset[2]; const charset x;
  265. /* SunOS 4.1.1 cc rejects this. */
  266. char const *const *p;
  267. char **p2;
  268. /* HPUX 7.0 cc rejects these. */
  269. ++p;
  270. p2 = (char const* const*) p;
  271.  }" > conftest.c
  272. if eval $compile; then
  273.   :
  274. else
  275.   DEFS="$DEFS -Dconst="
  276. fi
  277. rm -f conftest*
  278.  
  279. echo checking for ANSI prototypes
  280. cat <<EOF > conftest.c
  281.  
  282. #ifdef __STDC__
  283.   yes
  284. #endif
  285.  
  286. EOF
  287. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  288. if egrep "yes" conftest.out >/dev/null 2>&1; then
  289.   :
  290. else 
  291.   U=_
  292. fi
  293. rm -f conftest*
  294.  
  295.  
  296. echo checking for ANSI C header files
  297. cat <<EOF > conftest.c
  298.  
  299. #include <stdlib.h>
  300. #include <stdarg.h>
  301. #include <string.h>
  302. #include <float.h>
  303. #include <limits.h>
  304. EOF
  305. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  306. if test -z "$err"; then
  307.   DEFS="$DEFS -DSTDC_HEADERS=1"
  308. fi
  309. rm -f conftest*
  310.  
  311. echo checking for unistd.h
  312. cat <<EOF > conftest.c
  313.  
  314. #include <unistd.h>
  315. EOF
  316. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  317. if test -z "$err"; then
  318.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  319. fi
  320. rm -f conftest*
  321.  
  322. for hdr in string.h termcap.h
  323. do
  324. trfrom='[a-z]./' trto='[A-Z]__'
  325. echo checking for $hdr
  326. cat <<EOF > conftest.c
  327.  
  328. #include <$hdr>
  329. EOF
  330. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  331. if test -z "$err"; then
  332.   DEFS="$DEFS -DHAVE_`echo $hdr|tr "$trfrom" "$trto"`=1"
  333. fi
  334. rm -f conftest*
  335. done
  336.  
  337. echo checking return type of signal handlers
  338. echo '#include <signal.h>' > conftest.c
  339. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  340. if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  341.   :
  342. else 
  343.   DEFS="$DEFS -DRETSIGTYPE=int"
  344. fi
  345. rm -f conftest*
  346.  
  347.  
  348. for func in tputs
  349. do
  350. trfrom='[a-z]' trto='[A-Z]'
  351. echo checking for ${func}
  352. echo "
  353. main() { exit(0); } t() { 
  354. /* Override any gcc2 internal prototype to avoid an error.  */
  355. extern char ${func}(); ${func}(); }" > conftest.c
  356. if eval $compile; then
  357.   DEFS="$DEFS -DHAVE_`echo $func|tr "$trfrom" "$trto"`=1"
  358. fi
  359. rm -f conftest*
  360. done
  361.  
  362. for func in strstr
  363. do
  364. echo checking for ${func}
  365. echo "
  366. main() { exit(0); } t() { 
  367. /* Override any gcc2 internal prototype to avoid an error.  */
  368. extern char ${func}(); ${func}(); }" > conftest.c
  369. if eval $compile; then
  370.   :
  371. else
  372.   LIBOBJS="$LIBOBJS ${func}.o"
  373. fi
  374. rm -f conftest*
  375.  
  376. done
  377.  
  378. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  379. # for constant arguments.  Useless!
  380. echo checking for working alloca.h
  381. echo "#include <alloca.h>
  382. main() { exit(0); } t() { char *p = alloca(2 * sizeof(int)); }" > conftest.c
  383. if eval $compile; then
  384.   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  385. fi
  386. rm -f conftest*
  387.  
  388. decl="#ifdef __GNUC__
  389. #define alloca __builtin_alloca
  390. #else
  391. #if HAVE_ALLOCA_H
  392. #include <alloca.h>
  393. #else
  394. #ifdef _AIX
  395.  #pragma alloca
  396. #else
  397. char *alloca ();
  398. #endif
  399. #endif
  400. #endif
  401. "
  402. echo checking for alloca
  403. echo "$decl
  404. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  405. if eval $compile; then
  406.   :
  407. else
  408.   alloca_missing=1
  409. fi
  410. rm -f conftest*
  411.  
  412. if test -n "$alloca_missing"; then
  413.   SAVELIBS="$LIBS"
  414.   # Maybe alloca is in a different library.
  415.   #if test -f /usr/ucblib/libucb.a; then
  416.     # Avoid the broken BSD compatibility library as much as possible.
  417.     #LIBS="$LIBS -L/usr/ucblib -lc -lucb" trylib=-lucb # SVR4
  418.   #el
  419.   if test -f /lib/libPW.a; then
  420.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  421.   fi
  422.   if test -n "$trylib"; then
  423.     alloca_missing=
  424.     echo checking for alloca in $trylib
  425. echo "$decl
  426. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  427. if eval $compile; then
  428.   :
  429. else
  430.   alloca_missing=1
  431. fi
  432. rm -f conftest*
  433.  
  434.   fi
  435.   if test -n "$alloca_missing"; then
  436.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  437.   fi
  438. fi
  439.  
  440. if test -n "$prefix"; then
  441.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  442.   prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  443. fi
  444. if test -n "$exec_prefix"; then
  445.   prsub="$prsub
  446. s%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  447. fi
  448.  
  449. trap 'rm -f config.status; exit 1' 1 3 15
  450. echo creating config.status
  451. rm -f config.status
  452. cat <<EOF > config.status
  453. #!/bin/sh
  454. # Generated automatically by configure.
  455. # Run this file to recreate the current configuration.
  456. # This directory was configured as follows,
  457. # on host `(hostname || uname -n) 2>/dev/null`:
  458. #
  459. # $0 $*
  460.  
  461. case "\$1" in
  462.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  463.   exec /bin/sh $0 $* ;;
  464. esac
  465.  
  466. trap 'rm -f Makefile; exit 1' 1 3 15
  467. CC='$CC'
  468. INSTALL='$INSTALL'
  469. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  470. INSTALL_DATA='$INSTALL_DATA'
  471. DIFF='$DIFF'
  472. PAGER='$PAGER'
  473. CPP='$CPP'
  474. U='$U'
  475. LIBOBJS='$LIBOBJS'
  476. ALLOCA='$ALLOCA'
  477. LIBS='$LIBS'
  478. srcdir='$srcdir'
  479. DEFS='$DEFS'
  480. prefix='$prefix'
  481. exec_prefix='$exec_prefix'
  482. prsub='$prsub'
  483. EOF
  484. cat <<\EOF >> config.status
  485.  
  486. top_srcdir=$srcdir
  487. for file in Makefile; do
  488.   srcdir=$top_srcdir
  489.   # Remove last slash and all that follows it.  Not all systems have dirname.
  490.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  491.   if test "$dir" != "$file"; then
  492.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  493.     test ! -d $dir && mkdir $dir
  494.   fi
  495.   echo creating $file
  496.   rm -f $file
  497.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  498.   sed -e "
  499. $prsub
  500. s%@CC@%$CC%g
  501. s%@INSTALL@%$INSTALL%g
  502. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  503. s%@INSTALL_DATA@%$INSTALL_DATA%g
  504. s%@DIFF@%$DIFF%g
  505. s%@PAGER@%$PAGER%g
  506. s%@CPP@%$CPP%g
  507. s%@U@%$U%g
  508. s%@LIBOBJS@%$LIBOBJS%g
  509. s%@ALLOCA@%$ALLOCA%g
  510. s%@LIBS@%$LIBS%g
  511. s%@srcdir@%$srcdir%g
  512. s%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
  513. done
  514.  
  515. EOF
  516. chmod +x config.status
  517. test -n "$no_create" || ./config.status
  518.  
  519.